package com.zdb.demo.design.pattern.structural.flyweight;

import java.util.HashMap;
import java.util.Map;

public class EmployeeFactory {

    private final static Map<String, Employee> EMPLOYEE_MAP = new HashMap<>();

    public static Manager getManager(String department) {
        if(!EMPLOYEE_MAP.containsKey(department)) {
            Manager manager = new Manager(department);
            manager.setReportContent("部门" + department + "报告内容....");
            EMPLOYEE_MAP.put(department, manager);
            System.out.println("---- 生成部门经理：" + department);
        }
        return (Manager)EMPLOYEE_MAP.get(department);
    }

}
